import request from "@/utils/request.js";

export function getPortalExerciseInfoByPage(params) {
  return request.post(`/portal/exercise/getPortalExerciseInfoByPage`, params);
}
export function modifyPortalExerciseInfo(params) {
  if (params.id) {
    return request.post(`/portal/exercise/modifyPortalExerciseInfo`, params);
  } else {
    return request.post(`/portal/exercise/addPortalExerciseInfo`, params);
  }
}
//应用管理
export const apiUrl = {
  baseUrl: "/portalweb-api",
};
// 政府质量奖(荣誉)

// 分页列表查询接口
export function getQualityMapInfoByPage(params) {
  let param = JSON.parse(JSON.stringify(params));
  delete param.dataContext;
  return request.post(`/portal/qualityMapInfo/getQualityMapInfoByPage`, param);
  // let param = JSON.parse(JSON.stringify(params));
  // delete param.dataType;
  // delete param.dataContext;
  // return request.post(`/portal/qualityMapInfo/getQualityMapInfoByPage?dataContext=${params.dataContext}`, param)
}

// 详情接口
export function getQualityMapInfoByAdmin(params) {
  return request.get(`/portal/qualityMapInfo/getQualityMapInfoByAdmin`, {
    params: params,
  });
}

// 新增接口
export function addQualityMapInfo(params) {
  let param = JSON.parse(JSON.stringify(params));
  delete param.dataContext;
  return request.post(`/portal/qualityMapInfo/addQualityMapInfo`, param);

  // let param = JSON.parse(JSON.stringify(params));
  // delete param.dataType;
  // delete param.dataContext;
  // return request.post(`/portal/qualityMapInfo/addQualityMapInfo?dataType=${params.dataType}&dataContext=${params.dataContext}`, param)
}

// 修改接口
export function modifyQualityMapInfo(params) {
  let param = JSON.parse(JSON.stringify(params));
  delete param.dataContext;
  return request.post(`/portal/qualityMapInfo/modifyQualityMapInfo`, param);
  // let param = JSON.parse(JSON.stringify(params));
  // delete param.dataType;
  // delete param.dataContext;
  // return request.post(`/portal/qualityMapInfo/modifyQualityMapInfo?dataType=${params.dataType}&dataContext=${params.dataContext}`, param)
}

// 删除接口
export function delQualityMapInfo(params) {
  let param = JSON.parse(JSON.stringify(params));
  delete param.dataType;
  delete param.dataContext;
  return request.post(
    `/portal/qualityMapInfo/delQualityMapInfo?dataType=${params.dataType}&dataContext=${params.id}`
  );
}

// 市区县接口
export function getCityDistrictCountyInfoList(params) {
  // let param = JSON.parse(JSON.stringify(params));
  // delete param.dataType;
  // delete param.dataContext;
  return request.get(`/portalCommon/getCityDistrictCountyInfoList`);
}

// ----------新型标准化技术组织清单功能接口------------
//删除
export function delListNewStanTechOrgById(params) {
  return request.post(
    `/portal/listNewStanTechOrg/delListNewStanTechOrgById`,
    params
  );
}
//通过id获取ListNewStanTechOrg详情
export function getListNewStanTechOrgDetailById(params) {
  return request.get(
    `/portal/listNewStanTechOrg/getListNewStanTechOrgDetailById`,
    { params: params }
  );
}
//列表
export function getListNewStanTechOrgPageList(params) {
  return request.post(
    `/portal/listNewStanTechOrg/getListNewStanTechOrgPageList`,
    params
  );
}
//修改
export function updateListNewStanTechOrgById(params) {
  if (params.id) {
    return request.post(
      `/portal/listNewStanTechOrg/updateListNewStanTechOrgById`,
      params
    );
  } else {
    return request.post(`/portal/listNewStanTechOrg/addListNewStanTechOrg`, {
      data: params,
      rid: "",
    });
  }
}

//修改
export function addBatchListNewStanTechOrg(params) {
  return request.post(`/portal/listNewStanTechOrg/addBatchListNewStanTechOrg`, {
    data: params,
    rid: "",
  });
}
export function CMSApiUpload(data) {
  return request({
    url: `/portal/CMSApi/upload`,
    method: "post",
    headers: {
      "content-type": "multipart/form-data",
    },
    params: {},
    data,
  });
}

export function CMSApiDownloadFile(params) {
  return request({
    url: `/portal/CMSApi/download`,
    method: "get",
    responseType: "blob",
    params,
  });
}

export function addOrUpdateVideo(params) {
  if (params.id) {
    return request.post(`/video/updateVideoInfo`, params);
  }
  return request.post(`/video/addVideo`, params);
}
export function getVideosByManagePage(params) {
  return request.post(`/video/getVideosByManagePage`, params);
}
